Circle
Last name:
Student ID:
Class:
Date: 2012-4
Lab: Circle
Lab content:
I am using the MidPoint Circle Method (improved (2) algorithm)
Core algorithms:
// Draw 8 symmetric points
PublicStatic voidDraweightpoint (IntX,IntY, graphics g)
{
G. filloval (Offsetx+ X,Offsety+ Y,Pointsize,Pointsize);
G. filloval (Offsetx+ X
Draw circle algorithm and the position along the circle path areThe procedure for implementing a midpoint circle algorithm is given in the following section. The RADIUS value and the center coordinate are passed to the procedureCirclemidpoint. It then calculates a pixel position on the first eight-point circle and pas
a set of straight segments. The more segments in a polyline, the smoother the curve. Figure 3.15 shows several of the polyline displays used to represent arcs. The third option is to write your own curve generation function as shown below . First, a high-speed algorithm for generating circles and ellipses is discussed, and then a function for generating other two curves, polynomial, and spline curves is then seen.Circle Generation algorithmbecause circles are often used in
Computer Graphics (MFC) circleKey points: Read 674 comments 0Font size: large, medium, small
//////////////////////////////////////// ////////////////////////////
// Circle by the incircle integer algorithm //
//////////////////////////////////////// /////////////////////////////
Void roundmid (INT X1, int Y1, int R, CDC * PDC)
{
Int x = 0, y = R;
Int d = 1-r; // start point (0, R), next point midpoint (1,
the center coordinate of the canvas center_x= Center_x+m_vcirclex;center_y=center_y-m_vcircley;pdc->setpixel (center_x , Center_y+m_vradius,rgb (125,125,125));//Draw Center point Pdc->ellipse (center_x-3,center_y-3,center_x+3, center_y+3); //draw a small circle to determine the center position intp=5/4-m_vradius; //the initial value of the key value Intx=0;inty=m_ vradius;//using the midpoint circle algor
;
CenterX/= 4.0;
CenterY = Rectangley1+rectangley2+rectangley3+rectangley4;
CenterY/= 4.0;
Edge = (Rectanglex1-centerx)
To know whether a circle and a rectangle intersect, you can actually judge the center of two graphs,
At first, a lot of people would use a two-center distance and (R+EDGE/2) to judge
But as shown, (assuming that the intersection is a little bit into the rectangle, the diagram is not clear ha), O1o2 distance is greater th
is f (x,y) = 0 for points on the Circle, and F (x,y) >0 for dots outside of the circle, for Point F (x,y) D=f (M) =f (xp+1,yp-0.5) = (xp+1) hydrate (yp-0.5) 2-R2If the dD=f (xp+2,yp-0.5) = (xp+2) (yp-0.5) 2-r2=d+2xp+3If the d≥0, then should take P2 for the next pixel, and the next pixel discriminant isD=f (xp+2,yp-1.5) = (xp+2) hydrate (yp-1.5) 2-r2=d+2 (XP-YP) +5The first pixel we're talking about here is
Original: http://www.cnblogs.com/jscode/archive/2012/10/19/2730905.htmlToday in Css-tricks saw an article, that article let me can not help but the heart of a shock, powerful CSS Ah, incredibly able to draw so many basic graphics. The graph includes basic rectangles, circles, ellipses, triangles, and polygons, as well as a slightly more complex love, diamonds, and yin-yang gossip. Of course there are some need to use the CSS3 properties, so when you o
The graph includes basic rectangles, circles, ellipses, triangles, and polygons, as well as a slightly more complex love, diamonds, and yin-yang gossip. Of course there are some need to use the CSS3 properties, so when you open this article, I hope you use Firefox or Chrome, of course, ie can also see part of the. Well, here's a look at how we use pure CSS to draw these graphics, if you also feel very shocked, recommend to your friends.1, SquareFinal
The graph includes basic rectangles, circles, ellipses, triangles, and polygons, as well as a slightly more complex love, diamonds, and yin-yang gossip. Of course there are some need to use the CSS3 properties, so when you open this article, I hope you use Firefox or Chrome, of course, ie can also see part of the. Well, here's a look at how we use pure CSS to draw these graphics, if you also feel very shocked, recommend to your friends.1, SquareFinal
Algorithm Description:The algorithm of the midpoint generation of a circleIf we construct the functionF(x,y)= x2+ y2- R2, the points on the circle haveF(x,y) = 0, for points outside the circleF(x,y) >0, for points within the circleF(x,y) As with the midpoint drawing line method, the construction discriminant:D=F(M)=F( xp+1,yp -0.5) = (XP+ 1)2+(YP-0.5)2- R2if D P1 is the next pixel, and then the discriminant of the next pixel is:D=F(XP+2,YP-0.5) = (X
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.